from sklearn import datasets
from matplotlib import pyplot as plt

# 1、 用来加载sklearn 手写数字识别图片的数据
digits = datasets.load_digits()

images_index = list(zip(digits.images,digits.target))
plt.figure(figsize = (8,6),dpi = 200)
for index,(image,label) in enumerate(images_index[:8]):
    plt.subplot(2,4,index+1)
    plt.axis('off')
    plt.imshow(image,cmap = plt.cm.gray_r,interpolation='nearest')
    plt.title('Digit: %i' %label,fontsize = 20)